/*
	File:		Entity.h
	Author:		dmonroe
	Date:		11/27/2012
	Copyright:	Full Sail University

	Purpose:	Base class for game objects
*/

#ifndef ENTITY_H
#define ENTITY_H

#include "../source/IEntity.h"
#include "../source/Geometry.h"			// required for SRect
#include "../source/SGD_Handle.h"		// required for HTexture

class CEntityController;

class CEntity : public IEntity
{
public:
	CEntity( void );
	virtual ~CEntity( void );

	// IEntity Interface:
	virtual void		Input			( float fElapsedTime );
	virtual void		Update			( float fElapsedTime );
	virtual void		Render			( float fElapsedTime );

	virtual int			GetType			( void );
	virtual bool		IsCollidable	( void );
	virtual bool		OnCollision		( const IEntity* );

	virtual void		AddRef			( void );
	virtual void		Release			( void );


	// CEntity Interface:
	virtual SRect		GetRect			( void ) const;


	// Accessors
	HTexture			GetImage		( void ) const			{	return m_hImage;		}
	float				GetPositionX	( void ) const			{	return m_fPositionX;	}
	float				GetPositionY	( void ) const			{	return m_fPositionY;	}
	float				GetVelocityX	( void ) const			{	return m_fVelocityX;	}
	float				GetVelocityY	( void ) const			{	return m_fVelocityY;	}
	unsigned long		GetWidth		( void ) const			{	return m_ulWidth;		}
	unsigned long		GetHeight		( void ) const			{	return m_ulHeight;		}
	
	// Mutators
	void				SetController	( CEntityController* p );
	void				SetImage		( HTexture		h	)	{	m_hImage		= h;	}
	void				SetPositionX	( float			x	)	{	m_fPositionX	= x;	}
	void				SetPositionY	( float			y	)	{	m_fPositionY	= y;	}
	void				SetVelocityX	( float			vx	)	{	m_fVelocityX	= vx;	}
	void				SetVelocityY	( float			vy	)	{	m_fVelocityY	= vy;	}
	void				SetWidth		( unsigned long	w	)	{	m_ulWidth		= w;	}
	void				SetHeight		( unsigned long	h	)	{	m_ulHeight		= h;	}

protected:
	// logic controller (human or ai)
	CEntityController*	m_pController;

	// image
	HTexture			m_hImage;

	// position
	float				m_fPositionX;
	float				m_fPositionY;

	// velocity
	float				m_fVelocityX;
	float				m_fVelocityY;

	// size
	unsigned long		m_ulWidth;
	unsigned long		m_ulHeight;

	// reference count
	unsigned long		m_ulReferenceCount;
};

#endif //IENTITY_H
